package com.collect.collect.api.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.collect.collect.api.dao.ApiLogMapper;
import com.collect.collect.api.entity.ApiLog;
import com.collect.collect.api.service.IApiLogService;
import com.collect.collect.api.util.StringUtils;
import com.collect.collect.config.annotation.DataSource;
import com.collect.collect.config.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
@DataSource(DataSourceType.SLAVE)
public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper, ApiLog> implements IApiLogService {

    @Autowired
    private ApiLogMapper apiLogMapper;

    /**
     * 新增日志
     * @param apiLog
     * @return
     */
    @Override
    public boolean insertApiLog(ApiLog apiLog) {
        apiLog.setCreateDate(new Date());
        return save(apiLog);
    }
}
